<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<title>提问商品咨询</title>
	    <%@include file="../common/common.jsp" %>
    	<script type="text/javascript" src="${ctx }/js/fastclick.js"></script>
	
		<script type="text/javascript">
			/****提交商品咨询***/
			function btnConsult(){
				var consultContent = $(".contentPP").text();
				if(consultContent == null || consultContent=="" || consultContent=="请写下您的问题4-40字"){
					alert("商品咨询内容不能为空！！！")
					return false;
				}
				var goodsId = $("#goodsId").val();
				var creater = $("#creater").val();
				$.ajax({
					url : "${ctx}/consultComment/addConsult",
					type : "POST",
					async : false,
					data : {"goodsId":goodsId,"creater":creater,"consultContent":consultContent},
					success: function(data, status){
						if(data.resultSuccess){
							window.location.href="${ctx}/goods/queryGoodsDetail?id="+goodsId;
						}else{
							alert("数据提交失败，请联系管理员！")
						}
					},
					error : function (xhr, status, e){
						alert("服务器请求失败，请检查！"+e)
					}
				});	
			}
		</script>
	
	</head>

	<body>
		<header>
			<nav class="headerTwo">
				<img src="${ctx }/image/bg.png" alt="" />
				<a href="javascript:history.back(-1)" class="fl"><img src="${ctx }/image/return.png" alt="" /></a>
				<h2>提问</h2>
			</nav>
		</header>
		<div class="pay" ></div>
		<input type="hidden" name="goodsId" id="goodsId" value="${goodsId }">
		<input type="hidden" name="creater" id="creater" value="${creater }">
		
		<div class="questionS clearfix">
			<a href="#" >
				<img src="${ctx }/image/pic120.png" alt="" class="fl"/>
				<p class="fl moreWord">${goodsName }</p>
				<img src="${ctx }/image/right12-20.png" alt="" class="fr"/>
			</a>
		</div>	
		<p contenteditable='true' class="contentPP text1">请写下您的问题4-40字</p>
		<div class="questionX clearfix">
			<img src="${ctx }/image/yuan1.png" alt="" />
			<span>匿名评价</span>
			<a href="javascript:void(0);" onclick="btnConsult();" class="fr">确定</a>
		</div>
	</body>
  <script type="text/javascript" src="${ctx }/js/public.js"> </script>
</html>